using System;
using System.Collections.Generic;
using System.Text;
using Objects;
namespace DAL
{
   public class DALKhachHangNhanTheKhac
    {
       public int Insert(KhachHangNhanTheKhac Item)
       {
           clsDataAccess acc = new clsDataAccess();


           string[] sname = new string[] { "@NguoiNhan", "@SoDienThoai", "@DiaChi", "@ThongDiep", "@GhiChu", "@Status", "@SapXep" };
           string[] vname = new string[] {Item.NguoiNhan.ToString(), Item.SoDienThoai.ToString(), Item.DiaChi.ToString(), Item.ThongDiep.ToString(), Item.GhiChu.ToString(), Item.Status.ToString(), Item.SapXep.ToString()};
           return acc.InsertUpdateDetete("KhachHangNhanTheKhac_Insert", sname, vname);

       }

       public KhachHangNhanTheKhac GetById(int Id)
       {
           clsDataAccess acc = new clsDataAccess();
           string[] sname = new string[] { "@Id" };
           string[] vname = new string[] { Id.ToString() };
           System.Data.DataSet ds = acc.CommandSelect("KhachHangNhanTheKhac_GetById", sname, vname);
           KhachHangNhanTheKhac Item = new KhachHangNhanTheKhac();

           System.Data.DataRow dr = ds.Tables[0].Rows[0];
           return Item.Populate(dr);
       }

       public KhachHangNhanTheKhac GetMaxId()
       {
           clsDataAccess acc = new clsDataAccess();
           string[] sname = new string[] { "Status" };
           string[] vname = new string[] { Common.Myconst.HOATDONG.ToString()};
           System.Data.DataSet ds = acc.CommandSelect("KhachHangNhanTheKhac_GetMaxId", sname, vname);
           KhachHangNhanTheKhac Item = new KhachHangNhanTheKhac();

           System.Data.DataRow dr = ds.Tables[0].Rows[0];
           return Item.Populate(dr);
       }

    }
}
